package com.example.demo.controller;


import com.example.demo.entity.Designer;
import com.example.demo.utils.QRCodeUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
public class Erweima {
    @RequestMapping("/erweima")
    @ResponseBody
    public String erweima(HttpSession httpSession) throws Exception {
        String text = ((Designer) httpSession.getAttribute("designer")).getDesId().toString();
        httpSession.setAttribute("text",text);
//        String text = "http://193.112.22.6/";  //这里设置自定义网站url
//        String logoPath = "E:\\1906\\asdf\\test.jpg";
//        String destPath = "E:\\1906\\asdf\\";
        String encode = QRCodeUtils.encode(text, "/www/dyrshuodong/asdf/test.jpg", "/www/dyrshuodong/asdf/", true);
        System.out.println(encode);

        return text;
    }
    @RequestMapping("/geterweima")
    @ResponseBody
    private String geterweima(HttpSession httpSession){
        String text = (String) httpSession.getAttribute("text");
        return text;
    }
}
